package fangzhiyi.test;

/**
 * @author fangzhiyi
 * @version 1.0
 * @date 2025/3/18 18:43
 * @description 人类
 */
public class Person {
    private String name;
    private int age;

    public Person() {
    }

    public Person(String name, int age) {
        this.name = name;
        this.age = age;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        if (age<0){
            age=0;
        }
        this.age = age;
    }

    public void display(){
        System.out.println("姓名"+this.name+",年龄:"+this.age);
    }
}
